package com.chb.entity;

import lombok.Data;

import java.util.HashSet;

/**
 * @description:
 * @author: CHB
 * @create: 2021-12-08 09:44
 **/
@Data
public class FileDto {

    private Long id;
    private String filePath;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public FileDto(Long id, String filePath){
        this.filePath=filePath;
        this.id=id;
    }

    @Override
    public String toString(){
        return "id: "+this.id+",path: "+this.filePath;
    }

    // @Override
    // public int hashCode(){
    //     return this.id.hashCode()+this.filePath.hashCode();
    // }
    //
    // @Override
    // public boolean equals(Object obj) {
    //     FileDto f = ((FileDto)obj);
    //     return f.filePath.equals(this.filePath) && f.id.equals(this.id);
    // }
}
class A{

    public static void main(String[] args) {
        HashSet<FileDto> fSet = new HashSet<>();
        FileDto f1 = new FileDto(1L,"张三");
        FileDto f2 = new FileDto(1L,"张三");
        fSet.add(f1);
        fSet.add(f2);
        for (FileDto fileDto : fSet) {
            System.out.println(fileDto + "  -----  " + fileDto.hashCode());
        }
    }

}
